package com.caochenlei.graph;

public class GraphTest {
    public static void main(String[] args) {
        Graph G = new Graph(13);
        G.addEdge(0, 5);
        G.addEdge(0, 1);
        G.addEdge(0, 2);
        G.addEdge(0, 6);
        G.addEdge(5, 3);
        G.addEdge(5, 4);
        G.addEdge(3, 4);
        G.addEdge(4, 6);

        G.addEdge(7, 8);

        G.addEdge(9, 11);
        G.addEdge(9, 12);
        G.addEdge(9, 10);
        G.addEdge(11, 12);

        System.out.println("获取G的大小：" + G.size());
        System.out.println("获取G的边数：" + G.edge());
        System.out.println("====================");
        for (int v = 0; v < G.size(); v++) {
            System.out.println("获取" + v + "的邻点：" + G.adj(v));
        }
        System.out.println("====================");
        for (int v = 0; v < G.size(); v++) {
            System.out.println("获取" + v + "的度数：" + G.degree(v));
        }
        System.out.println("====================");
        System.out.println("获取所有顶点的最大度数：" + G.maxDegree());
        System.out.println("获取所有顶点的平均度数：" + G.avgDegree());
        System.out.println("====================");
        System.out.println(G);
    }
}
